package com.zsrt.t08;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

import javax.imageio.spi.RegisterableService;import javax.swing.plaf.basic.BasicButtonUI;

import org.junit.Test;

public class T08 {
	@Test
	public void test5(){
		FileInputStream fis = null;
		InputStreamReader isr = null;
		try {
			fis = new FileInputStream("e:\\sw.txt");
			isr = new InputStreamReader(fis, "gbk");
			char[] buff = new char[1024];
			int len = 0;
			while((len = isr.read(buff)) != -1){
				System.out.println(new String(buff, 0, len));
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if(isr != null){
				try {
					isr.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
	@Test
	public void add(){
		FileInputStream fis=null;
		InputStreamReader isr=null;
		try {
			fis= new FileInputStream("e:\\sw.txt");
			isr= new InputStreamReader(fis,"gbk");
			char[] buff=new char[1024];
			int len;
			while((len =isr.read(buff)) !=-1){
			System.out.println(new String(buff,0,len));	
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (IOException e) {
		
			e.printStackTrace();
		}
		
		
	}
	

}
